/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package has.game;

import EJB_GameLogic.GameLogicRemote;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.naming.InitialContext;


/**
 *
 * @author DROWNE
 */
@WebService()
public class GameServices {

    /**
     * Web service operation
     */
    @WebMethod(operationName = "Register")
    public Integer Register(@WebParam(name = "username")
    String username, @WebParam(name = "password")
    String password, @WebParam(name = "nickname")
    String nickname, @WebParam(name = "email")
    String email) throws Exception {

        InitialContext ic = new InitialContext();
        GameLogicRemote gameLogicInterface=(GameLogicRemote)ic.lookup("EJB_GameLogic.GameLogicRemote");
        return gameLogicInterface.registerUser(username, password, nickname, email);
    }

    /**
     * Web service operation
     */
    @WebMethod(operationName = "Login")
    public Integer Login(@WebParam(name = "username")
    String username, @WebParam(name = "password")
    String password) throws Exception {
       InitialContext ic = new InitialContext();
       GameLogicRemote gameLogicInterface=(GameLogicRemote)ic.lookup("EJB_GameLogic.GameLogicRemote");
       return gameLogicInterface.loginUser(username, password);
    }
}
